package com.yanfan.parking.service.impl;

import java.util.Arrays;
import java.util.List;
import com.yanfan.common.utils.DateUtils;
import com.yanfan.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yanfan.parking.mapper.NjParkingCarInfoMapper;
import com.yanfan.parking.domain.NjParkingCarInfo;
import com.yanfan.parking.service.INjParkingCarInfoService;

/**
 * 车辆信息Service业务层处理
 *
 * @author genluo
 * @date 2024-10-31
 */
@Service
public class NjParkingCarInfoServiceImpl extends ServiceImpl<NjParkingCarInfoMapper, NjParkingCarInfo> implements INjParkingCarInfoService {
    @Autowired
    private NjParkingCarInfoMapper njParkingCarInfoMapper;


    /**
     * 查询车辆信息列表
     *
     * @param njParkingCarInfo 车辆信息
     * @return 车辆信息
     */
    @Override
    public List<NjParkingCarInfo> queryPageList(NjParkingCarInfo njParkingCarInfo) {
        LambdaQueryWrapper<NjParkingCarInfo> lqw = buildQueryWrapper(njParkingCarInfo);
        return njParkingCarInfoMapper.selectList(lqw);
        //连表查询可用该方法，在此方法SQL语句上进行扩展
        //return njParkingCarInfoMapper.queryPageList(njParkingCarInfo);
    }

    /**
    * 分页查询条件
    * @return
    */
    private LambdaQueryWrapper<NjParkingCarInfo> buildQueryWrapper(NjParkingCarInfo bo) {
        LambdaQueryWrapper<NjParkingCarInfo> lqw = Wrappers.lambdaQuery();
        lqw.like(StringUtils.isNotBlank(bo.getCarNum()), NjParkingCarInfo::getCarNum, bo.getCarNum());
        lqw.like(StringUtils.isNotBlank(bo.getParkingLot()), NjParkingCarInfo::getParkingLot, bo.getParkingLot());
        lqw.like(StringUtils.isNotBlank(bo.getOwner()), NjParkingCarInfo::getOwner, bo.getOwner());
        lqw.like(StringUtils.isNotBlank(bo.getListTypeStr()), NjParkingCarInfo::getListTypeStr, bo.getListTypeStr()); lqw.eq(StringUtils.isNotBlank(bo.getCarTypeStr()), NjParkingCarInfo::getCarTypeStr, bo.getCarTypeStr());
        return lqw;
    }



}
